[C#] How to consume web service adheres to the Event-based Asynchronous Pattern?
Posted
by codemonkie
on Stack Overflow
See other posts from Stack Overflow
or by codemonkie
Published on 2010-04-09T11:40:16Z
Indexed on
2010/04/09
11:43 UTC
Read the original article
Hit count: 282
I am following the example from
http://msdn.microsoft.com/en-us/library/8wy069k1.aspx
to consume a web service implemented (by 3rd party) using the Event-based Asynchronous Pattern.
However, my program needs to do multiple calls to the DoStuffAsync()
hence will get back as many DoStuffCompleted
. I chose the overload which takes an extra parameter - Object userState
to distinguish them.
My first question is:
Is it valid to cast a GUID
to Object as below, where GUID is used to generate unique taskID?
Object userState = Guid.NewGuid();
Secondly, do I need to spawn off a new thread for each DoStuffAsync()
call, since I am calling it multiple times?
Also, would be nice to have some online examples or tutorials on this subject. (I've been googling for it the whole day and didn't get much back)
Many thanks
© Stack Overflow or respective owner